package com.px.idal;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.px.model.ReviewGroupInfo;

public interface IReviewGroupInfoMapper {

	/**
	 * 查询方法
	 * 查询所有评审组
	 * 使用@Select 注解指明getAllReviewGroupInfos方法要执行的SQL
	 * */
	@Select("select * from review_tb")
	public List<ReviewGroupInfo> getAllReviewGroupInfos();

	/**
	 * Insert方法
	 * 增加评审组company_info_tb 
	 * 传参为对象方法
	 * */
	@Insert("insert into review_tb(review_name,review_tip,review_award_id)value(#{review_name},#{review_tip},#{review_award_id})")
	public int insertReviewGroups(ReviewGroupInfo reviews);

	/**
	 * 更新方法
	 * 更新指定review_id的评审组
	 * 示例
	 * */
	@Update("UPDATE review_tb SET review_name = #{review_name},review_tip=#{review_tip},review_award_id=#{review_award_id} where review_id=#{review_id}")
	public int updateReviewGroupByReviewGroupId(ReviewGroupInfo reviews);

	/**
	 * 查询方法
	 * 查询指定review_id的评审组
	 * 示例
	 * */
	@Select("select * from review_tb where review_id=#{review_id}")
	public List<ReviewGroupInfo> getReviewGroupByReviewGroupId(ReviewGroupInfo reviews);

	/**
	 * 删除方法
	 * 删除指定review_id的评审组
	 * 示例
	 * */
	@Delete("delete from review_tb where review_id=#{review_id}")
	public int deleteReviewGroupInfoByReviewGroupInfoId(ReviewGroupInfo reviews);

	/**
	 * 查询用户信息总条数
	 *  
	 * */
	@Select("select count(*) from review_tb")
	public int getAllReviewGroupCounts();

	/**
	 * 查询指定review_id是否存在
	 * 
	 * */
	@Select("select count(*) from review_tb where review_id=#{review_id}")
	public int checkReviewIdIsExist(ReviewGroupInfo reviews);

	/**
	 * 根据专家id查找评审组信息
	 * 
	 * */
	@Select("select * FROM specialist_review_rel_tb,review_tb WHERE specialist_review_rel_tb.review_id=review_tb.review_id AND specialist_review_rel_tb.specialist_id=#{specialist_id}")
	public List<ReviewGroupInfo> getReviewGroupInfoBySpecialistId(@Param("specialist_id") int specialist_id);

}
